package com.jinsi.controller.tang;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jinsi.constant.YltConstant;
import com.jinsi.pojo.Examine;
import com.jinsi.service.tang.CheckService;
import com.jinsi.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 审核商品详情列表
 * @author 唐文博
 * @Date 2022-08-18
 */
@RestController
@RequestMapping("/check")
public class CheckController {
    @Autowired
    private CheckService checkService;

    /**
     * 查看表，全查，分页
     * @param page
     * @param limit
     * @param commodityId
     * @return
     */
    @RequestMapping("/getCheck")
    public R getCheck(Integer page, Integer limit, Integer commodityId) {
        PageHelper.startPage(page, limit);
        List<Examine> list = checkService.getCheck(commodityId);
        PageInfo<Examine> pageInfo = new PageInfo<>(list);
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                pageInfo.getList(),
                pageInfo.getTotal());
    }
}
